xquery version "1.0";

import module namespace actmod="http://www.example.com/actmod" at "xmldb:exist:///db/projdb/modules/activity_mod.xqm";

declare namespace dc = "http://purl.org/dc/elements/1.1/";
declare namespace pm = "http://www.politicalmashup.nl";
declare namespace xsi = "http://www.w3.org/2001/XMLSchema-instance";

(: collection to investigate :)
let $periods := ('2009-2010', '2010-2011', '2011-2012', '2012-2013', '2013-2014')
let $speaker_file := doc('/db/projdb/lijst_van_sprekers_ge2009.xml')
let $mayors_file := doc('/db/projdb/lijst_burgemeesters_2007.xml')
let $output_collection := 'xmldb:exist:///db/projdb'
for $period in $periods
    let $doc := collection('/db/projdb/ge-2009')[data(./root//pm:legislative-period) = $period]
    let $onderbrekers_totalen_file := doc(concat('/db/projdb/onderbrekerstotalen_', $period, '.xml'))
    let $iandp_file := doc(concat('/db/projdb/initiators_and_participants_ge2009_', $period, '.xml'))
    let $output_filename := concat('participatie_parameters_ge2009_', $period, '.xml')
    return actmod:generate_activity_parameters($doc, $iandp_file, $speaker_file, $mayors_file, $onderbrekers_totalen_file, $output_collection, $output_filename)
